import java.util.Scanner;

public class demo04 {
    //幸运数
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int m=sc.nextInt();
        int n=sc.nextInt();
        int[] arr=new int[n];
        for (int i = 0; i < n; i++) {
            arr[i]=2*i+1;
        }
        int lucky=1;
        while (arr[lucky]<n){
            int p=lucky+1;
            for (int i = lucky+1; i < n; i++) {
                if((i+1)%arr[lucky]!=0){
                    arr[p]=arr[i];
                    p++;
                }
            }
            lucky++;
        }
        int sum=0;
        for (int i = 0; i < n; i++) {
            if(arr[i]>m&&arr[i]<n){
                sum++;
            }
        }
        System.out.println(sum);
    }
}
